package com.tgb.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tgb.mapper.BannerMapper;
import com.tgb.model.Banner;
import com.tgb.model.example.BannerExample;
import com.tgb.service.BannerService;

@Service
@Transactional  //此处不再进行创建SqlSession和提交事务，都已交由spring去管理了。
public class BannerServiceImpl implements BannerService {
	
	@Resource
	private BannerMapper mapper;

	public int deleteByExample(BannerExample example) {
		
		return mapper.deleteByExample(example);
	}

	public List<Banner> selectAllBanner() {
		
		List<Banner> bannerList = mapper.selectAllBanner();
		
		return bannerList;
	}

	public Banner selectByPrimaryKey(int id) {

		Banner banner = mapper.selectByPrimaryKey(id);
		
		return banner;
	}

	public int insertSelective(Banner banner) {

		return mapper.insertSelective(banner);
	}
	

	public int updateByExampleSelective(Banner banner,BannerExample id) {

		return mapper.updateByExampleSelective(banner, id);
	}

}
